- 'mac/libusb/**'
- 'reference/**'
- 'shapelib/**'
+ - 'strptime/**'
- 'zlib/**'
- coverity_model.cc
- - strptime.[ch]
- jeeps/gpsproj.cc
- jeeps/gpsproj.h
- tools/qtci/README.md
src/core/vector3d.cc
src/core/xmlstreamwriter.cc
src/core/xmltag.cc
- strptime.c
units.cc
util.cc
util_crc.cc
session.h
shape.h
skytraq.h
- strptime.h
subrip.h
text.h
unicsv.h
set(SOURCES ${SOURCES} gbser_posix.cc)
set(HEADERS ${HEADERS} gbser_posix.h)
target_compile_options(gpsbabel PRIVATE -Wall)
- # disable warning from strptime.c, which we don't want to own or modify
- set_source_files_properties(strptime.c PROPERTIES COMPILE_OPTIONS -Wno-unused-but-set-variable)
endif()
if(WIN32)
include(shapelib.cmake)
include(zlib.cmake)
include(libusb.cmake)
+include(strptime.cmake)
set(GPSBABEL_EXTRA_LINK_LIBRARIES "" CACHE STRING "extra libraries to link with.")
list(APPEND LIBS ${GPSBABEL_EXTRA_LINK_LIBRARIES})
+++ /dev/null
-/* Convert a string representation of time to a time value.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* XXX This version of the implementation is not really complete.
- Some of the fields cannot add information alone. But if seeing
- some of them in the same format (such as year, week and weekday)
- this is enough information for determining the date. */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <ctype.h>
-#include <limits.h>
-#include <string.h>
-#include <time.h>
-
-#ifdef _LIBC
-# include "../locale/localeinfo.h"
-#endif
-
-#include "strptime.h"
-
-#ifndef __P
-# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-# define __P(args) args
-# else
-# define __P(args) ()
-# endif /* GCC. */
-#endif /* Not __P. */
-
-#if ! HAVE_LOCALTIME_R && ! defined localtime_r
-# ifdef _LIBC
-# define localtime_r __localtime_r
-# else
-/* Approximate localtime_r as best we can in its absence. */
-# define localtime_r my_localtime_r
-static struct tm *localtime_r __P((const time_t *, struct tm *));
-static struct tm *
-localtime_r(t, tp)
-const time_t *t;
-struct tm *tp;
-{
- struct tm *l = localtime(t);
- if (! l) {
- return 0;
- }
- *tp = *l;
- return tp;
-}
-# endif /* ! _LIBC */
-#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
-
-
-#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
-#if defined __GNUC__ && __GNUC__ >= 2
-# define match_string(cs1, s2) \
- ({ size_t len = strlen (cs1); \
- int result = strncasecmp ((cs1), (s2), len) == 0; \
- if (result) (s2) += len; \
- result; })
-#else
-/* Oh come on. Get a reasonable compiler. */
-# define match_string(cs1, s2) \
- (case_ignore_strncmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
-/* now now, don't need to be rude .... */
-static
-int
-case_ignore_strncmp(const char *s1, const char *s2, int n)
-{
- int rv = 0;
-
- while (n && ((rv = toupper(*s1) - toupper(*s2)) == 0)
- && *s1) {
- s1++;
- s2++;
- n--;
- }
- return rv;
-}
-#endif
-/* We intentionally do not use isdigit() for testing because this will
- lead to problems with the wide character version. */
-#define get_number(from, to, n) \
- do { \
- int __n = n; \
- val = 0; \
- while (*rp == ' ') \
- ++rp; \
- if (*rp < '0' || *rp > '9') \
- return NULL; \
- do { \
- val *= 10; \
- val += *rp++ - '0'; \
- } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \
- if (val < from || val > to) \
- return NULL; \
- } while (0)
-#ifdef _NL_CURRENT
-# define get_alt_number(from, to, n) \
- ({ \
- __label__ do_normal; \
- if (*decided != raw) \
- { \
- const char *alts = _NL_CURRENT (LC_TIME, ALT_DIGITS); \
- int __n = n; \
- int any = 0; \
- while (*rp == ' ') \
- ++rp; \
- val = 0; \
- do { \
- val *= 10; \
- while (*alts != '\0') \
- { \
- size_t len = strlen (alts); \
- if (strncasecmp (alts, rp, len) == 0) \
- break; \
- alts += len + 1; \
- ++val; \
- } \
- if (*alts == '\0') \
- { \
- if (*decided == not && ! any) \
- goto do_normal; \
- /* If we haven't read anything it's an error. */ \
- if (! any) \
- return NULL; \
- /* Correct the premature multiplication. */ \
- val /= 10; \
- break; \
- } \
- else \
- *decided = loc; \
- } while (--__n > 0 && val * 10 <= to); \
- if (val < from || val > to) \
- return NULL; \
- } \
- else \
- { \
- do_normal: \
- get_number (from, to, n); \
- } \
- 0; \
- })
-#else
-# define get_alt_number(from, to, n) \
- /* We don't have the alternate representation. */ \
- get_number(from, to, n)
-#endif
-#define recursive(new_fmt) \
- (*(new_fmt) != '\0' \
- && (rp = strptime_internal (rp, (new_fmt), tm, decided, era_cnt)) != NULL)
-
-
-#ifdef _LIBC
-/* This is defined in locale/C-time.c in the GNU libc. */
-extern const struct locale_data _nl_C_LC_TIME;
-extern const unsigned short int __mon_yday[2][13];
-
-# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
-# define ab_weekday_name \
- (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
-# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
-# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
-# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
-# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
-# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
-# define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
-# define HERE_T_FMT_AMPM \
- (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
-# define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
-
-# define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
-#else
-static char const weekday_name[][10] = {
- "Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday"
-};
-static char const ab_weekday_name[][4] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
-static char const month_name[][10] = {
- "January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"
-};
-static char const ab_month_name[][4] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
-# define HERE_D_FMT "%m/%d/%y"
-# define HERE_AM_STR "AM"
-# define HERE_PM_STR "PM"
-# define HERE_T_FMT_AMPM "%I:%M:%S %p"
-# define HERE_T_FMT "%H:%M:%S"
-
-const unsigned short int __mon_yday[2][13] = {
- /* Normal years. */
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
- /* Leap years. */
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
-};
-#endif
-
-/* Status of lookup: do we use the locale data or the raw data? */
-enum locale_status { not, loc, raw };
-
-
-#ifndef __isleap
-/* Nonzero if YEAR is a leap year (every 4 years,
- except every 100th isn't, and every 400th is). */
-# define __isleap(year) \
- ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
-#endif
-
-/* Compute the day of the week. */
-static void
-day_of_the_week(struct tm *tm)
-{
- /* We know that January 1st 1970 was a Thursday (= 4). Compute the
- the difference between this data in the one on TM and so determine
- the weekday. */
- int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
- int wday = (-473
- + (365 * (tm->tm_year - 70))
- + (corr_year / 4)
- - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
- + (((corr_year / 4) / 25) / 4)
- + __mon_yday[0][tm->tm_mon]
- + tm->tm_mday - 1);
- tm->tm_wday = ((wday % 7) + 7) % 7;
-}
-
-/* Compute the day of the year. */
-static void
-day_of_the_year(struct tm *tm)
-{
- tm->tm_yday = (__mon_yday[__isleap(1900 + tm->tm_year)][tm->tm_mon]
- + (tm->tm_mday - 1));
-}
-
-static char *
-#ifdef _LIBC
-internal_function
-#endif
-strptime_internal __P((const char *rp, const char *fmt, struct tm *tm,
- enum locale_status *decided, int era_cnt));
-
-static char *
-#ifdef _LIBC
-internal_function
-#endif
-strptime_internal(rp, fmt, tm, decided, era_cnt)
-const char *rp;
-const char *fmt;
-struct tm *tm;
-enum locale_status *decided;
-int era_cnt;
-{
- const char *rp_backup;
- int cnt;
- int val;
- int have_I, is_pm;
- int century, want_century;
- int want_era;
- int have_wday, want_xday;
- int have_yday;
- int have_mon, have_mday;
-#ifdef _NL_CURRENT
- size_t num_eras;
-#endif
- struct era_entry *era;
-
- have_I = is_pm = 0;
- century = -1;
- want_century = 0;
- want_era = 0;
- era = NULL;
-
- have_wday = want_xday = have_yday = have_mon = have_mday = 0;
-
- while (*fmt != '\0') {
- /* A white space in the format string matches 0 more or white
- space in the input string. */
- if (isspace(*fmt)) {
- while (isspace(*rp)) {
- ++rp;
- }
- ++fmt;
- continue;
- }
-
- /* Any character but `%' must be matched by the same character
- in the iput string. */
- if (*fmt != '%') {
- match_char(*fmt++, *rp++);
- continue;
- }
-
- ++fmt;
-#ifndef _NL_CURRENT
- /* We need this for handling the `E' modifier. */
-start_over:
-#endif
-
- /* Make back up of current processing pointer. */
- rp_backup = rp;
-
- switch (*fmt++) {
- case '%':
- /* Match the `%' character itself. */
- match_char('%', *rp++);
- break;
- case 'a':
- case 'A':
- /* Match day of week. */
- for (cnt = 0; cnt < 7; ++cnt) {
-#ifdef _NL_CURRENT
- if (*decided !=raw) {
- if (match_string(_NL_CURRENT(LC_TIME, DAY_1 + cnt), rp)) {
- if (*decided == not
- && strcmp(_NL_CURRENT(LC_TIME, DAY_1 + cnt),
- weekday_name[cnt])) {
- *decided = loc;
- }
- break;
- }
- if (match_string(_NL_CURRENT(LC_TIME, ABDAY_1 + cnt), rp)) {
- if (*decided == not
- && strcmp(_NL_CURRENT(LC_TIME, ABDAY_1 + cnt),
- ab_weekday_name[cnt])) {
- *decided = loc;
- }
- break;
- }
- }
-#endif
- if (*decided != loc
- && (match_string(weekday_name[cnt], rp)
- || match_string(ab_weekday_name[cnt], rp))) {
- *decided = raw;
- break;
- }
- }
- if (cnt == 7)
- /* Does not match a weekday name. */
- {
- return NULL;
- }
- tm->tm_wday = cnt;
- have_wday = 1;
- break;
- case 'b':
- case 'B':
- case 'h':
- /* Match month name. */
- for (cnt = 0; cnt < 12; ++cnt) {
-#ifdef _NL_CURRENT
- if (*decided !=raw) {
- if (match_string(_NL_CURRENT(LC_TIME, MON_1 + cnt), rp)) {
- if (*decided == not
- && strcmp(_NL_CURRENT(LC_TIME, MON_1 + cnt),
- month_name[cnt])) {
- *decided = loc;
- }
- break;
- }
- if (match_string(_NL_CURRENT(LC_TIME, ABMON_1 + cnt), rp)) {
- if (*decided == not
- && strcmp(_NL_CURRENT(LC_TIME, ABMON_1 + cnt),
- ab_month_name[cnt])) {
- *decided = loc;
- }
- break;
- }
- }
-#endif
- if (match_string(month_name[cnt], rp)
- || match_string(ab_month_name[cnt], rp)) {
- *decided = raw;
- break;
- }
- }
- if (cnt == 12)
- /* Does not match a month name. */
- {
- return NULL;
- }
- tm->tm_mon = cnt;
- want_xday = 1;
- break;
- case 'c':
- /* Match locale's date and time format. */
-#ifdef _NL_CURRENT
- if (*decided != raw) {
- if (!recursive(_NL_CURRENT(LC_TIME, D_T_FMT))) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (*decided == not &&
- strcmp(_NL_CURRENT(LC_TIME, D_T_FMT), HERE_D_T_FMT)) {
- *decided = loc;
- }
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!recursive(HERE_D_T_FMT)) {
- return NULL;
- }
- want_xday = 1;
- break;
- case 'C':
- /* Match century number. */
-#ifdef _NL_CURRENT
-match_century:
-#endif
- get_number(0, 99, 2);
- century = val;
- want_xday = 1;
- break;
- case 'd':
- case 'e':
- /* Match day of month. */
- get_number(1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'F':
- if (!recursive("%Y-%m-%d")) {
- return NULL;
- }
- want_xday = 1;
- break;
- case 'x':
-#ifdef _NL_CURRENT
- if (*decided != raw) {
- if (!recursive(_NL_CURRENT(LC_TIME, D_FMT))) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (*decided == not
- && strcmp(_NL_CURRENT(LC_TIME, D_FMT), HERE_D_FMT)) {
- *decided = loc;
- }
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- /* Fall through. */
- case 'D':
- /* Match standard day format. */
- if (!recursive(HERE_D_FMT)) {
- return NULL;
- }
- want_xday = 1;
- break;
- case 'k':
- case 'H':
- /* Match hour in 24-hour clock. */
- get_number(0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock. */
- get_number(1, 12, 2);
- tm->tm_hour = val % 12;
- have_I = 1;
- break;
- case 'j':
- /* Match day number of year. */
- get_number(1, 366, 3);
- tm->tm_yday = val - 1;
- have_yday = 1;
- break;
- case 'm':
- /* Match number of month. */
- get_number(1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minute. */
- get_number(0, 59, 2);
- tm->tm_min = val;
- break;
- case 'n':
- case 't':
- /* Match any white space. */
- while (isspace(*rp)) {
- ++rp;
- }
- break;
- case 'p':
- /* Match locale's equivalent of AM/PM. */
-#ifdef _NL_CURRENT
- if (*decided != raw) {
- if (match_string(_NL_CURRENT(LC_TIME, AM_STR), rp)) {
- if (strcmp(_NL_CURRENT(LC_TIME, AM_STR), HERE_AM_STR)) {
- *decided = loc;
- }
- break;
- }
- if (match_string(_NL_CURRENT(LC_TIME, PM_STR), rp)) {
- if (strcmp(_NL_CURRENT(LC_TIME, PM_STR), HERE_PM_STR)) {
- *decided = loc;
- }
- is_pm = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!match_string(HERE_AM_STR, rp)) {
- if (match_string(HERE_PM_STR, rp)) {
- is_pm = 1;
- } else {
- return NULL;
- }
- }
- break;
- case 'r':
-#ifdef _NL_CURRENT
- if (*decided != raw) {
- if (!recursive(_NL_CURRENT(LC_TIME, T_FMT_AMPM))) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (*decided == not &&
- strcmp(_NL_CURRENT(LC_TIME, T_FMT_AMPM),
- HERE_T_FMT_AMPM)) {
- *decided = loc;
- }
- break;
- }
- *decided = raw;
- }
-#endif
- if (!recursive(HERE_T_FMT_AMPM)) {
- return NULL;
- }
- break;
- case 'R':
- if (!recursive("%H:%M")) {
- return NULL;
- }
- break;
- case 's': {
- /* The number of seconds may be very high so we cannot use
- the `get_number' macro. Instead read the number
- character for character and construct the result while
- doing this. */
- time_t secs = 0;
- if (*rp < '0' || *rp > '9')
- /* We need at least one digit. */
- {
- return NULL;
- }
-
- do {
- secs *= 10;
- secs += *rp++ - '0';
- } while (*rp >= '0' && *rp <= '9');
-
- if (localtime_r(&secs, tm) == NULL)
- /* Error in function. */
- {
- return NULL;
- }
- }
- break;
- case 'S':
- get_number(0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'X':
-#ifdef _NL_CURRENT
- if (*decided != raw) {
- if (!recursive(_NL_CURRENT(LC_TIME, T_FMT))) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (strcmp(_NL_CURRENT(LC_TIME, T_FMT), HERE_T_FMT)) {
- *decided = loc;
- }
- break;
- }
- *decided = raw;
- }
-#endif
- /* Fall through. */
- case 'T':
- if (!recursive(HERE_T_FMT)) {
- return NULL;
- }
- break;
- case 'u':
- get_number(1, 7, 1);
- tm->tm_wday = val % 7;
- have_wday = 1;
- break;
- case 'g':
- get_number(0, 99, 2);
- /* XXX This cannot determine any field in TM. */
- break;
- case 'G':
- if (*rp < '0' || *rp > '9') {
- return NULL;
- }
- /* XXX Ignore the number since we would need some more
- information to compute a real date. */
- do {
- ++rp;
- } while (*rp >= '0' && *rp <= '9');
- break;
- case 'U':
- case 'V':
- case 'W':
- get_number(0, 53, 2);
- /* XXX This cannot determine any field in TM without some
- information. */
- break;
- case 'w':
- /* Match number of weekday. */
- get_number(0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
-#ifdef _NL_CURRENT
-match_year_in_century:
-#endif
- /* Match year within century. */
- get_number(0, 99, 2);
- /* The "Year 2000: The Millennium Rollover" paper suggests that
- values in the range 69-99 refer to the twentieth century. */
- tm->tm_year = val >= 69 ? val : val + 100;
- /* Indicate that we want to use the century, if specified. */
- want_century = 1;
- want_xday = 1;
- break;
- case 'Y':
- /* Match year including century number. */
- get_number(0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'Z':
- /* XXX How to handle this? */
- break;
- case 'E':
-#ifdef _NL_CURRENT
- switch (*fmt++) {
- case 'c':
- /* Match locale's alternate date and time format. */
- if (*decided != raw) {
- const char *fmt = _NL_CURRENT(LC_TIME, ERA_D_T_FMT);
-
- if (*fmt == '\0') {
- fmt = _NL_CURRENT(LC_TIME, D_T_FMT);
- }
-
- if (!recursive(fmt)) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (strcmp(fmt, HERE_D_T_FMT)) {
- *decided = loc;
- }
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- if (!recursive(HERE_D_T_FMT)) {
- return NULL;
- }
- want_xday = 1;
- break;
- case 'C':
- if (*decided != raw) {
- if (era_cnt >= 0) {
- era = _nl_select_era_entry(era_cnt);
- if (match_string(era->era_name, rp)) {
- *decided = loc;
- break;
- } else {
- return NULL;
- }
- } else {
- num_eras = _NL_CURRENT_WORD(LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup) {
- era = _nl_select_era_entry(era_cnt);
- if (match_string(era->era_name, rp)) {
- *decided = loc;
- break;
- }
- }
- if (era_cnt == (int) num_eras) {
- era_cnt = -1;
- if (*decided == loc) {
- return NULL;
- }
- } else {
- break;
- }
- }
-
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- goto match_century;
- case 'y':
- if (*decided == raw) {
- goto match_year_in_century;
- }
-
- get_number(0, 9999, 4);
- tm->tm_year = val;
- want_era = 1;
- want_xday = 1;
- break;
- case 'Y':
- if (*decided != raw) {
- num_eras = _NL_CURRENT_WORD(LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup) {
- era = _nl_select_era_entry(era_cnt);
- if (recursive(era->era_format)) {
- break;
- }
- }
- if (era_cnt == (int) num_eras) {
- era_cnt = -1;
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- *decided = loc;
- era_cnt = -1;
- break;
- }
-
- *decided = raw;
- }
- get_number(0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'x':
- if (*decided != raw) {
- const char *fmt = _NL_CURRENT(LC_TIME, ERA_D_FMT);
-
- if (*fmt == '\0') {
- fmt = _NL_CURRENT(LC_TIME, D_FMT);
- }
-
- if (!recursive(fmt)) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (strcmp(fmt, HERE_D_FMT)) {
- *decided = loc;
- }
- break;
- }
- *decided = raw;
- }
- if (!recursive(HERE_D_FMT)) {
- return NULL;
- }
- break;
- case 'X':
- if (*decided != raw) {
- const char *fmt = _NL_CURRENT(LC_TIME, ERA_T_FMT);
-
- if (*fmt == '\0') {
- fmt = _NL_CURRENT(LC_TIME, T_FMT);
- }
-
- if (!recursive(fmt)) {
- if (*decided == loc) {
- return NULL;
- } else {
- rp = rp_backup;
- }
- } else {
- if (strcmp(fmt, HERE_T_FMT)) {
- *decided = loc;
- }
- break;
- }
- *decided = raw;
- }
- if (!recursive(HERE_T_FMT)) {
- return NULL;
- }
- break;
- default:
- return NULL;
- }
- break;
-#else
- /* We have no information about the era format. Just use
- the normal format. */
- if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
- && *fmt != 'x' && *fmt != 'X')
- /* This is an illegal format. */
- {
- return NULL;
- }
-
- goto start_over;
-#endif
- case 'O':
- switch (*fmt++) {
- case 'd':
- case 'e':
- /* Match day of month using alternate numeric symbols. */
- get_alt_number(1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'H':
- /* Match hour in 24-hour clock using alternate numeric
- symbols. */
- get_alt_number(0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock using alternate numeric
- symbols. */
- get_alt_number(1, 12, 2);
- tm->tm_hour = val - 1;
- have_I = 1;
- break;
- case 'm':
- /* Match month using alternate numeric symbols. */
- get_alt_number(1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minutes using alternate numeric symbols. */
- get_alt_number(0, 59, 2);
- tm->tm_min = val;
- break;
- case 'S':
- /* Match seconds using alternate numeric symbols. */
- get_alt_number(0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'U':
- case 'V':
- case 'W':
- get_alt_number(0, 53, 2);
- /* XXX This cannot determine any field in TM without
- further information. */
- break;
- case 'w':
- /* Match number of weekday using alternate numeric symbols. */
- get_alt_number(0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
- /* Match year within century using alternate numeric symbols. */
- get_alt_number(0, 99, 2);
- tm->tm_year = val >= 69 ? val : val + 100;
- want_xday = 1;
- break;
- default:
- return NULL;
- }
- break;
- default:
- return NULL;
- }
- }
-
- if (have_I && is_pm) {
- tm->tm_hour += 12;
- }
-
- if (century != -1) {
- if (want_century) {
- tm->tm_year = tm->tm_year % 100 + (century - 19) * 100;
- } else
- /* Only the century, but not the year. Strange, but so be it. */
- {
- tm->tm_year = (century - 19) * 100;
- }
- }
-
-#ifdef _NL_CURRENT
- if (era_cnt != -1) {
- era = _nl_select_era_entry(era_cnt);
- if (want_era)
- tm->tm_year = (era->start_date[0]
- + ((tm->tm_year - era->offset)
- * era->absolute_direction));
- else
- /* Era start year assumed. */
- {
- tm->tm_year = era->start_date[0];
- }
- } else
-#endif
- if (want_era) {
- return NULL;
- }
-
- if (want_xday && !have_wday) {
- if (!(have_mon && have_mday) && have_yday) {
- /* We don't have tm_mon and/or tm_mday, compute them. */
- int t_mon = 0;
- while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday) {
- t_mon++;
- }
- if (!have_mon) {
- tm->tm_mon = t_mon - 1;
- }
- if (!have_mday)
- tm->tm_mday =
- (tm->tm_yday
- - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
- }
- day_of_the_week(tm);
- }
- if (want_xday && !have_yday) {
- day_of_the_year(tm);
- }
-
- return (char *) rp;
-}
-
-
-char *
-strptime(buf, format, tm)
-const char *buf;
-const char *format;
-struct tm *tm;
-{
- enum locale_status decided;
-
-#ifdef _NL_CURRENT
- decided = not;
-#else
- decided = raw;
-#endif
- return strptime_internal(buf, format, tm, &decided, -1);
-}
--- /dev/null
+add_library(strptime STATIC
+ strptime/strptime_l.c
+ strptime/strptime.h
+)
+if(MSVC)
+ target_compile_definitions(strptime PRIVATE _CRT_SECURE_NO_WARNINGS)
+ target_compile_options(strptime PRIVATE -wd4101 -wd4102 -wd4267)
+endif()
+target_include_directories(strptime INTERFACE strptime)
+list(APPEND LIBS strptime)
+++ /dev/null
-/* strptime.h
- *
- * $Id: strptime.h,v 1.1 2005-07-16 17:02:10 robertl Exp $
- *
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __STRPTIME_H__
-#define __STRPTIME_H__
-
-/*
- * Version of "strptime()", for the benefit of OSes that don't have it.
- */
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern char* strptime(const char*, const char*, struct tm*);
-#ifdef __cplusplus
-}
-#endif
-#endif
-
--- /dev/null
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
--- /dev/null
+This file contains the copying permission notices for various files in the
+GNU C Library distribution that have copyright owners other than the Free
+Software Foundation. These notices all require that a copy of the notice
+be included in the accompanying documentation and be distributed with
+binary distributions of the code, so be sure to include this file along
+with any binary distributions derived from the GNU C Library.
+
+\f
+All code incorporated from 4.4 BSD is distributed under the following
+license:
+
+Copyright (C) 1991 Regents of the University of California.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. [This condition was removed.]
+4. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+\f
+The DNS resolver code, taken from BIND 4.9.5, is copyrighted by UC
+Berkeley, by Digital Equipment Corporation and by Internet Software
+Consortium. The DEC portions are under the following license:
+
+Portions Copyright (C) 1993 by Digital Equipment Corporation.
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies, and
+that the name of Digital Equipment Corporation not be used in
+advertising or publicity pertaining to distribution of the document or
+software without specific, written prior permission.
+
+THE SOFTWARE IS PROVIDED ``AS IS'' AND DIGITAL EQUIPMENT CORP.
+DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+\f
+The ISC portions are under the following license:
+
+Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+\f
+The Sun RPC support (from rpcsrc-4.0) is covered by the following
+license:
+
+Copyright (c) 2010, Oracle America, Inc.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials
+ provided with the distribution.
+ * Neither the name of the "Oracle America, Inc." nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+\f
+The following CMU license covers some of the support code for Mach,
+derived from Mach 3.0:
+
+Mach Operating System
+Copyright (C) 1991,1990,1989 Carnegie Mellon University
+All Rights Reserved.
+
+Permission to use, copy, modify and distribute this software and its
+documentation is hereby granted, provided that both the copyright
+notice and this permission notice appear in all copies of the
+software, derivative works or modified versions, and any portions
+thereof, and that both notices appear in supporting documentation.
+
+CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS ``AS IS''
+CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+
+Carnegie Mellon requests users of this software to return to
+
+ Software Distribution Coordinator
+ School of Computer Science
+ Carnegie Mellon University
+ Pittsburgh PA 15213-3890
+
+or Software.Distribution@CS.CMU.EDU any improvements or
+extensions that they make and grant Carnegie Mellon the rights to
+redistribute these changes.
+\f
+The file if_ppp.h is under the following CMU license:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND
+ CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\f
+The following license covers the files from Intel's "Highly Optimized
+Mathematical Functions for Itanium" collection:
+
+Intel License Agreement
+
+Copyright (c) 2000, Intel Corporation
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+* The name of Intel Corporation may not be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+\f
+The files inet/getnameinfo.c and sysdeps/posix/getaddrinfo.c are copyright
+(C) by Craig Metz and are distributed under the following license:
+
+/* The Inner Net License, Version 2.00
+
+ The author(s) grant permission for redistribution and use in source and
+binary forms, with or without modification, of the software and documentation
+provided that the following conditions are met:
+
+0. If you receive a version of the software that is specifically labelled
+ as not being for redistribution (check the version message and/or README),
+ you are not permitted to redistribute that version of the software in any
+ way or form.
+1. All terms of the all other applicable copyrights and licenses must be
+ followed.
+2. Redistributions of source code must retain the authors' copyright
+ notice(s), this list of conditions, and the following disclaimer.
+3. Redistributions in binary form must reproduce the authors' copyright
+ notice(s), this list of conditions, and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+4. [The copyright holder has authorized the removal of this clause.]
+5. Neither the name(s) of the author(s) nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ If these license terms cause you a real problem, contact the author. */
+\f
+The file sunrpc/des_impl.c is copyright Eric Young:
+
+Copyright (C) 1992 Eric Young
+Collected from libdes and modified for SECURE RPC by Martin Kuck 1994
+This file is distributed under the terms of the GNU Lesser General
+Public License, version 2.1 or later - see the file COPYING.LIB for details.
+If you did not receive a copy of the license with this program, please
+see <https://www.gnu.org/licenses/> to obtain a copy.
+\f
+The file inet/rcmd.c is under a UCB copyright and the following:
+
+Copyright (C) 1998 WIDE Project.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+\f
+The file posix/runtests.c is copyright Tom Lord:
+
+Copyright 1995 by Tom Lord
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of the copyright holder not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Tom Lord DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL TOM LORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+\f
+The posix/rxspencer tests are copyright Henry Spencer:
+
+Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved.
+This software is not subject to any license of the American Telephone
+and Telegraph Company or of the Regents of the University of California.
+
+Permission is granted to anyone to use this software for any purpose on
+any computer system, and to alter it and redistribute it, subject
+to the following restrictions:
+
+1. The author is not responsible for the consequences of use of this
+ software, no matter how awful, even if they arise from flaws in it.
+
+2. The origin of this software must not be misrepresented, either by
+ explicit claim or by omission. Since few users ever read sources,
+ credits must appear in the documentation.
+
+3. Altered versions must be plainly marked as such, and must not be
+ misrepresented as being the original software. Since few users
+ ever read sources, credits must appear in the documentation.
+
+4. This notice may not be removed or altered.
+\f
+The file posix/PCRE.tests is copyright University of Cambridge:
+
+Copyright (c) 1997-2003 University of Cambridge
+
+Permission is granted to anyone to use this software for any purpose on any
+computer system, and to redistribute it freely, subject to the following
+restrictions:
+
+1. This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+2. The origin of this software must not be misrepresented, either by
+ explicit claim or by omission. In practice, this means that if you use
+ PCRE in software that you distribute to others, commercially or
+ otherwise, you must put a sentence like this
+
+ Regular expression support is provided by the PCRE library package,
+ which is open source software, written by Philip Hazel, and copyright
+ by the University of Cambridge, England.
+
+ somewhere reasonably visible in your documentation and in any relevant
+ files or online help data or similar. A reference to the ftp site for
+ the source, that is, to
+
+ ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
+
+ should also be given in the documentation. However, this condition is not
+ intended to apply to whole chains of software. If package A includes PCRE,
+ it must acknowledge it, but if package B is software that includes package
+ A, the condition is not imposed on package B (unless it uses PCRE
+ independently).
+
+3. Altered versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+
+4. If PCRE is embedded in any software that is released under the GNU
+ General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
+ then the terms of that licence shall supersede any condition above with
+ which it is incompatible.
+\f
+Files from Sun fdlibm are copyright Sun Microsystems, Inc.:
+
+Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+Developed at SunPro, a Sun Microsystems, Inc. business.
+Permission to use, copy, modify, and distribute this
+software is freely granted, provided that this notice
+is preserved.
+\f
+Various long double libm functions are copyright Stephen L. Moshier:
+
+Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see
+ <https://www.gnu.org/licenses/>. */
--- /dev/null
+This directory contains the sources of the GNU C Library.
+See the file "version.h" for what release version you have.
+
+The GNU C Library is the standard system C library for all GNU systems,
+and is an important part of what makes up a GNU system. It provides the
+system API for all programs written in C and C-compatible languages such
+as C++ and Objective C; the runtime facilities of other programming
+languages use the C library to access the underlying operating system.
+
+In GNU/Linux systems, the C library works with the Linux kernel to
+implement the operating system behavior seen by user applications.
+In GNU/Hurd systems, it works with a microkernel and Hurd servers.
+
+The GNU C Library implements much of the POSIX.1 functionality in the
+GNU/Hurd system, using configurations i[4567]86-*-gnu.
+
+When working with Linux kernels, this version of the GNU C Library
+requires Linux kernel version 3.2 or later.
+
+Also note that the shared version of the libgcc_s library must be
+installed for the pthread library to work correctly.
+
+The GNU C Library supports these configurations for using Linux kernels:
+
+ aarch64*-*-linux-gnu
+ alpha*-*-linux-gnu
+ arc*-*-linux-gnu
+ arm-*-linux-gnueabi
+ csky-*-linux-gnuabiv2
+ hppa-*-linux-gnu
+ i[4567]86-*-linux-gnu
+ x86_64-*-linux-gnu Can build either x86_64 or x32
+ ia64-*-linux-gnu
+ loongarch64-*-linux-gnu Hardware floating point, LE only.
+ m68k-*-linux-gnu
+ microblaze*-*-linux-gnu
+ mips-*-linux-gnu
+ mips64-*-linux-gnu
+ or1k-*-linux-gnu
+ powerpc-*-linux-gnu Hardware or software floating point, BE only.
+ powerpc64*-*-linux-gnu Big-endian and little-endian.
+ s390-*-linux-gnu
+ s390x-*-linux-gnu
+ riscv32-*-linux-gnu
+ riscv64-*-linux-gnu
+ sh[34]-*-linux-gnu
+ sparc*-*-linux-gnu
+ sparc64*-*-linux-gnu
+
+If you are interested in doing a port, please contact the glibc
+maintainers; see https://www.gnu.org/software/libc/ for more
+information.
+
+See the file INSTALL to find out how to configure, build, and install
+the GNU C Library. You might also consider reading the WWW pages for
+the C library at https://www.gnu.org/software/libc/.
+
+The GNU C Library is (almost) completely documented by the Texinfo manual
+found in the `manual/' subdirectory. The manual is still being updated
+and contains some known errors and omissions; we regret that we do not
+have the resources to work on the manual as much as we would like. For
+corrections to the manual, please file a bug in the `manual' component,
+following the bug-reporting instructions below. Please be sure to check
+the manual in the current development sources to see if your problem has
+already been corrected.
+
+Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
+information. We are now using the Bugzilla system to track all bug reports.
+This web page gives detailed information on how to report bugs properly.
+
+The GNU C Library is free software. See the file COPYING.LIB for copying
+conditions, and LICENSES for notices about a few contributions that require
+these additional notices to be distributed. License copyright years may be
+listed using range notation, e.g., 1996-2015, indicating that every year in
+the range, inclusive, is a copyrightable year that would otherwise be listed
+individually.
--- /dev/null
+This is a modified subset of glibc from:
+https://sourceware.org/git/glibc.git
+cd glibc
+git checkout release/2.37/master
+
+The varbatim files from glibc.git are:
+COPYING
+COPYING.LIB
+LICENSES
+README
+
+The modified files from glibc.git are:
+strptime_l.c
--- /dev/null
+/* strptime.h
+ *
+ * $Id: strptime.h,v 1.1 2005-07-16 17:02:10 robertl Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __STRPTIME_H__
+#define __STRPTIME_H__
+
+/*
+ * Version of "strptime()", for the benefit of OSes that don't have it.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ extern char* strptime(const char*, const char*, struct tm*);
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /dev/null
+/* Copyright (C) 2002-2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <ctype.h>
+//#include <langinfo.h>
+#include <limits.h>
+#include <string.h>
+#include <time.h>
+#include <stdbool.h>
+
+#ifdef _LIBC
+# define HAVE_LOCALTIME_R 0
+# include "../locale/localeinfo.h"
+
+# define time_t __time64_t
+# define __localtime_r(t, tp) __localtime64_r (t, tp)
+#endif
+
+#if ! HAVE_LOCALTIME_R && ! defined localtime_r
+# ifdef _LIBC
+# define localtime_r __localtime_r
+# else
+/* Approximate localtime_r as best we can in its absence. */
+# define localtime_r my_localtime_r
+static struct tm *localtime_r (const time_t *, struct tm *);
+static struct tm *
+localtime_r (const time_t *t, struct tm *tp)
+{
+ struct tm *l = localtime (t);
+ if (! l)
+ return 0;
+ *tp = *l;
+ return tp;
+}
+# endif /* ! _LIBC */
+#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
+
+
+#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
+#if defined __GNUC__ && __GNUC__ >= 2
+# define match_string(cs1, s2) \
+ ({ size_t len = strlen (cs1); \
+ int result = strncasecmp ((cs1), (s2), len) == 0; \
+ if (result) (s2) += len; \
+ result; })
+#else
+/* Oh come on. Get a reasonable compiler. */
+# ifdef _WIN32
+# define match_string(cs1, s2) \
+ (_strnicmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
+# else
+# define match_string(cs1, s2) \
+ (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
+# endif
+#endif
+/* We intentionally do not use isdigit() for testing because this will
+ lead to problems with the wide character version. */
+#define get_number(from, to, n) \
+ do { \
+ int __n = n; \
+ val = 0; \
+ while (ISSPACE (*rp)) \
+ ++rp; \
+ if (*rp < '0' || *rp > '9') \
+ return NULL; \
+ do { \
+ val *= 10; \
+ val += *rp++ - '0'; \
+ } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \
+ if (val < from || val > to) \
+ return NULL; \
+ } while (0)
+#ifdef _NL_CURRENT
+# define get_alt_number(from, to, n) \
+ ({ \
+ __label__ do_normal; \
+ \
+ if (s.decided != raw) \
+ { \
+ val = _nl_parse_alt_digit (&rp HELPER_LOCALE_ARG); \
+ if (val == -1 && s.decided != loc) \
+ { \
+ s.decided = loc; \
+ goto do_normal; \
+ } \
+ if (val < from || val > to) \
+ return NULL; \
+ } \
+ else \
+ { \
+ do_normal: \
+ get_number (from, to, n); \
+ } \
+ 0; \
+ })
+#else
+# define get_alt_number(from, to, n) \
+ /* We don't have the alternate representation. */ \
+ get_number(from, to, n)
+#endif
+#define recursive(new_fmt) \
+ (*(new_fmt) != '\0' \
+ && (rp = __strptime_internal (rp, (new_fmt), tm, &s LOCALE_ARG)) != NULL)
+
+
+#ifdef _LIBC
+/* This is defined in locale/C-time.c in the GNU libc. */
+extern const struct __locale_data _nl_C_LC_TIME attribute_hidden;
+
+# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
+# define ab_weekday_name \
+ (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
+# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
+# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
+# define alt_month_name \
+ (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ALTMON_1)].string)
+# define ab_alt_month_name \
+ (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (_NL_ABALTMON_1)].string)
+# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
+# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
+# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
+# define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
+# define HERE_T_FMT_AMPM \
+ (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
+# define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
+
+# define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
+#else
+static char const weekday_name[][10] =
+ {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ };
+static char const ab_weekday_name[][4] =
+ {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+ };
+static char const month_name[][10] =
+ {
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"
+ };
+static char const ab_month_name[][4] =
+ {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
+# define HERE_D_FMT "%m/%d/%y"
+# define HERE_AM_STR "AM"
+# define HERE_PM_STR "PM"
+# define HERE_T_FMT_AMPM "%I:%M:%S %p"
+# define HERE_T_FMT "%H:%M:%S"
+
+static const unsigned short int __mon_yday[2][13] =
+ {
+ /* Normal years. */
+ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+ /* Leap years. */
+ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+ };
+#endif
+
+#if defined _LIBC
+/* We use this code also for the extended locale handling where the
+ function gets as an additional argument the locale which has to be
+ used. To access the values we have to redefine the _NL_CURRENT
+ macro. */
+# define strptime __strptime_l
+# undef _NL_CURRENT
+# define _NL_CURRENT(category, item) \
+ (current->values[_NL_ITEM_INDEX (item)].string)
+# undef _NL_CURRENT_WORD
+# define _NL_CURRENT_WORD(category, item) \
+ (current->values[_NL_ITEM_INDEX (item)].word)
+# define LOCALE_PARAM , locale_t locale
+# define LOCALE_ARG , locale
+# define HELPER_LOCALE_ARG , current
+# define ISSPACE(Ch) __isspace_l (Ch, locale)
+#else
+# define LOCALE_PARAM
+# define LOCALE_ARG
+# define HELPER_LOCALE_ARG
+# define ISSPACE(Ch) isspace (Ch)
+#endif
+
+
+
+
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+ except every 100th isn't, and every 400th is). */
+# define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+/* Compute the day of the week. */
+static void
+day_of_the_week (struct tm *tm)
+{
+ /* We know that January 1st 1970 was a Thursday (= 4). Compute the
+ difference between this data in the one on TM and so determine
+ the weekday. */
+ int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
+ int wday = (-473
+ + (365 * (tm->tm_year - 70))
+ + (corr_year / 4)
+ - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
+ + (((corr_year / 4) / 25) / 4)
+ + __mon_yday[0][tm->tm_mon]
+ + tm->tm_mday - 1);
+ tm->tm_wday = ((wday % 7) + 7) % 7;
+}
+
+/* Compute the day of the year. */
+static void
+day_of_the_year (struct tm *tm)
+{
+ tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon]
+ + (tm->tm_mday - 1));
+}
+
+
+#ifdef _LIBC
+char *
+#else
+static char *
+#endif
+__strptime_internal (const char *rp, const char *fmt, struct tm *tmp,
+ void *statep LOCALE_PARAM)
+{
+#ifdef _LIBC
+ struct __locale_data *const current = locale->__locales[LC_TIME];
+#endif
+
+ const char *rp_backup;
+ const char *rp_longest;
+ int cnt;
+ int cnt_longest;
+ size_t val;
+ size_t num_eras;
+ struct era_entry *era = NULL;
+ enum ptime_locale_status { not, loc, raw } decided_longest;
+ struct __strptime_state
+ {
+ unsigned int have_I : 1;
+ unsigned int have_wday : 1;
+ unsigned int have_yday : 1;
+ unsigned int have_mon : 1;
+ unsigned int have_mday : 1;
+ unsigned int have_uweek : 1;
+ unsigned int have_wweek : 1;
+ unsigned int is_pm : 1;
+ unsigned int want_century : 1;
+ unsigned int want_era : 1;
+ unsigned int want_xday : 1;
+ enum ptime_locale_status decided : 3;
+ signed char week_no;
+ signed char century;
+ int era_cnt;
+ } s;
+ struct tm tmb;
+ struct tm *tm;
+
+ if (statep == NULL)
+ {
+ memset (&s, 0, sizeof (s));
+ s.century = -1;
+ s.era_cnt = -1;
+#ifdef _NL_CURRENT
+ s.decided = not;
+#else
+ s.decided = raw;
+#endif
+ tm = tmp;
+ }
+ else
+ {
+ s = *(struct __strptime_state *) statep;
+ tmb = *tmp;
+ tm = &tmb;
+ }
+
+ while (*fmt != '\0')
+ {
+ /* A white space in the format string matches 0 more or white
+ space in the input string. */
+ if (ISSPACE (*fmt))
+ {
+ while (ISSPACE (*rp))
+ ++rp;
+ ++fmt;
+ continue;
+ }
+
+ /* Any character but `%' must be matched by the same character
+ in the input string. */
+ if (*fmt != '%')
+ {
+ match_char (*fmt++, *rp++);
+ continue;
+ }
+
+ ++fmt;
+ /* We discard strftime modifiers. */
+ while (*fmt == '-' || *fmt == '_' || *fmt == '0'
+ || *fmt == '^' || *fmt == '#')
+ ++fmt;
+
+ /* And field width. */
+ while (*fmt >= '0' && *fmt <= '9')
+ ++fmt;
+
+ /* In some cases, modifiers are handled by adjusting state and
+ then restarting the switch statement below. */
+ start_over:
+
+ /* Make back up of current processing pointer. */
+ rp_backup = rp;
+
+ switch (*fmt++)
+ {
+ case '%':
+ /* Match the `%' character itself. */
+ match_char ('%', *rp++);
+ break;
+ case 'a':
+ case 'A':
+ /* Match day of week. */
+ rp_longest = NULL;
+ decided_longest = s.decided;
+ cnt_longest = -1;
+ for (cnt = 0; cnt < 7; ++cnt)
+ {
+ const char *trp;
+#ifdef _NL_CURRENT
+ if (s.decided !=raw)
+ {
+ trp = rp;
+ if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), trp)
+ && trp > rp_longest)
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
+ weekday_name[cnt]))
+ decided_longest = loc;
+ }
+ trp = rp;
+ if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), trp)
+ && trp > rp_longest)
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
+ ab_weekday_name[cnt]))
+ decided_longest = loc;
+ }
+ }
+#endif
+ if (s.decided != loc
+ && (((trp = rp, match_string (weekday_name[cnt], trp))
+ && trp > rp_longest)
+ || ((trp = rp, match_string (ab_weekday_name[cnt], rp))
+ && trp > rp_longest)))
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ decided_longest = raw;
+ }
+ }
+ if (rp_longest == NULL)
+ /* Does not match a weekday name. */
+ return NULL;
+ rp = rp_longest;
+ s.decided = decided_longest;
+ tm->tm_wday = cnt_longest;
+ s.have_wday = 1;
+ break;
+ case 'b':
+ case 'B':
+ case 'h':
+ /* Match month name. */
+ rp_longest = NULL;
+ decided_longest = s.decided;
+ cnt_longest = -1;
+ for (cnt = 0; cnt < 12; ++cnt)
+ {
+ const char *trp;
+#ifdef _NL_CURRENT
+ if (s.decided !=raw)
+ {
+ trp = rp;
+ if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), trp)
+ && trp > rp_longest)
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
+ month_name[cnt]))
+ decided_longest = loc;
+ }
+ trp = rp;
+ if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), trp)
+ && trp > rp_longest)
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
+ ab_month_name[cnt]))
+ decided_longest = loc;
+ }
+#ifdef _LIBC
+ /* Now check the alt month. */
+ trp = rp;
+ if (match_string (_NL_CURRENT (LC_TIME, ALTMON_1 + cnt), trp)
+ && trp > rp_longest)
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, ALTMON_1 + cnt),
+ alt_month_name[cnt]))
+ decided_longest = loc;
+ }
+ trp = rp;
+ if (match_string (_NL_CURRENT (LC_TIME, _NL_ABALTMON_1 + cnt),
+ trp)
+ && trp > rp_longest)
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, _NL_ABALTMON_1 + cnt),
+ alt_month_name[cnt]))
+ decided_longest = loc;
+ }
+#endif
+ }
+#endif
+ if (s.decided != loc
+ && (((trp = rp, match_string (month_name[cnt], trp))
+ && trp > rp_longest)
+ || ((trp = rp, match_string (ab_month_name[cnt], trp))
+ && trp > rp_longest)
+#ifdef _LIBC
+ || ((trp = rp, match_string (alt_month_name[cnt], trp))
+ && trp > rp_longest)
+ || ((trp = rp, match_string (ab_alt_month_name[cnt], trp))
+ && trp > rp_longest)
+#endif
+ ))
+ {
+ rp_longest = trp;
+ cnt_longest = cnt;
+ decided_longest = raw;
+ }
+ }
+ if (rp_longest == NULL)
+ /* Does not match a month name. */
+ return NULL;
+ rp = rp_longest;
+ s.decided = decided_longest;
+ tm->tm_mon = cnt_longest;
+ s.have_mon = 1;
+ s.want_xday = 1;
+ break;
+ case 'c':
+ /* Match locale's date and time format. */
+#ifdef _NL_CURRENT
+ if (s.decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT)))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT))
+ s.decided = loc;
+ s.want_xday = 1;
+ break;
+ }
+ s.decided = raw;
+ }
+#endif
+ if (!recursive (HERE_D_T_FMT))
+ return NULL;
+ s.want_xday = 1;
+ break;
+ case 'C':
+ /* Match century number. */
+ match_century:
+ get_number (0, 99, 2);
+ s.century = val;
+ s.want_xday = 1;
+ break;
+ case 'd':
+ case 'e':
+ /* Match day of month. */
+ get_number (1, 31, 2);
+ tm->tm_mday = val;
+ s.have_mday = 1;
+ s.want_xday = 1;
+ break;
+ case 'F':
+ if (!recursive ("%Y-%m-%d"))
+ return NULL;
+ s.want_xday = 1;
+ break;
+ case 'x':
+#ifdef _NL_CURRENT
+ if (s.decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, D_FMT)))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT))
+ s.decided = loc;
+ s.want_xday = 1;
+ break;
+ }
+ s.decided = raw;
+ }
+#endif
+ /* Fall through. */
+ case 'D':
+ /* Match standard day format. */
+ if (!recursive (HERE_D_FMT))
+ return NULL;
+ s.want_xday = 1;
+ break;
+ case 'k':
+ case 'H':
+ /* Match hour in 24-hour clock. */
+ get_number (0, 23, 2);
+ tm->tm_hour = val;
+ s.have_I = 0;
+ break;
+ case 'l':
+ /* Match hour in 12-hour clock. GNU extension. */
+ case 'I':
+ /* Match hour in 12-hour clock. */
+ get_number (1, 12, 2);
+ tm->tm_hour = val % 12;
+ s.have_I = 1;
+ break;
+ case 'j':
+ /* Match day number of year. */
+ get_number (1, 366, 3);
+ tm->tm_yday = val - 1;
+ s.have_yday = 1;
+ break;
+ case 'm':
+ /* Match number of month. */
+ get_number (1, 12, 2);
+ tm->tm_mon = val - 1;
+ s.have_mon = 1;
+ s.want_xday = 1;
+ break;
+ case 'M':
+ /* Match minute. */
+ get_number (0, 59, 2);
+ tm->tm_min = val;
+ break;
+ case 'n':
+ case 't':
+ /* Match any white space. */
+ while (ISSPACE (*rp))
+ ++rp;
+ break;
+ case 'p':
+ /* Match locale's equivalent of AM/PM. */
+#ifdef _NL_CURRENT
+ if (s.decided != raw)
+ {
+ if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
+ {
+ if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR))
+ s.decided = loc;
+ s.is_pm = 0;
+ break;
+ }
+ if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
+ {
+ if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR))
+ s.decided = loc;
+ s.is_pm = 1;
+ break;
+ }
+ s.decided = raw;
+ }
+#endif
+ if (!match_string (HERE_AM_STR, rp))
+ {
+ if (match_string (HERE_PM_STR, rp))
+ s.is_pm = 1;
+ else
+ return NULL;
+ }
+ else
+ s.is_pm = 0;
+ break;
+ case 'r':
+#ifdef _NL_CURRENT
+ if (s.decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM)))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (s.decided == not
+ && strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM),
+ HERE_T_FMT_AMPM))
+ s.decided = loc;
+ break;
+ }
+ s.decided = raw;
+ }
+#endif
+ if (!recursive (HERE_T_FMT_AMPM))
+ return NULL;
+ break;
+ case 'R':
+ if (!recursive ("%H:%M"))
+ return NULL;
+ break;
+ case 's':
+ {
+ /* The number of seconds may be very high so we cannot use
+ the `get_number' macro. Instead read the number
+ character for character and construct the result while
+ doing this. */
+ time_t secs = 0;
+ if (*rp < '0' || *rp > '9')
+ /* We need at least one digit. */
+ return NULL;
+
+ do
+ {
+ secs *= 10;
+ secs += *rp++ - '0';
+ }
+ while (*rp >= '0' && *rp <= '9');
+
+ if (localtime_r (&secs, tm) == NULL)
+ /* Error in function. */
+ return NULL;
+ }
+ break;
+ case 'S':
+ get_number (0, 61, 2);
+ tm->tm_sec = val;
+ break;
+ case 'X':
+#ifdef _NL_CURRENT
+ if (s.decided != raw)
+ {
+ if (!recursive (_NL_CURRENT (LC_TIME, T_FMT)))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT))
+ s.decided = loc;
+ break;
+ }
+ s.decided = raw;
+ }
+#endif
+ /* Fall through. */
+ case 'T':
+ if (!recursive (HERE_T_FMT))
+ return NULL;
+ break;
+ case 'u':
+ get_number (1, 7, 1);
+ tm->tm_wday = val % 7;
+ s.have_wday = 1;
+ break;
+ case 'g':
+ get_number (0, 99, 2);
+ /* XXX This cannot determine any field in TM. */
+ break;
+ case 'G':
+ if (*rp < '0' || *rp > '9')
+ return NULL;
+ /* XXX Ignore the number since we would need some more
+ information to compute a real date. */
+ do
+ ++rp;
+ while (*rp >= '0' && *rp <= '9');
+ break;
+ case 'U':
+ get_number (0, 53, 2);
+ s.week_no = val;
+ s.have_uweek = 1;
+ break;
+ case 'W':
+ get_number (0, 53, 2);
+ s.week_no = val;
+ s.have_wweek = 1;
+ break;
+ case 'V':
+ get_number (0, 53, 2);
+ /* XXX This cannot determine any field in TM without some
+ information. */
+ break;
+ case 'w':
+ /* Match number of weekday. */
+ get_number (0, 6, 1);
+ tm->tm_wday = val;
+ s.have_wday = 1;
+ break;
+ case 'y':
+ match_year_in_century:
+ /* Match year within century. */
+ get_number (0, 99, 2);
+ /* The "Year 2000: The Millennium Rollover" paper suggests that
+ values in the range 69-99 refer to the twentieth century. */
+ tm->tm_year = val >= 69 ? val : val + 100;
+ /* Indicate that we want to use the century, if specified. */
+ s.want_century = 1;
+ s.want_xday = 1;
+ break;
+ case 'Y':
+ /* Match year including century number. */
+ get_number (0, 9999, 4);
+ tm->tm_year = val - 1900;
+ s.want_century = 0;
+ s.want_xday = 1;
+ break;
+ case 'Z':
+ /* Read timezone but perform no conversion. */
+ while (ISSPACE (*rp))
+ rp++;
+ while (!ISSPACE (*rp) && *rp != '\0')
+ rp++;
+ break;
+ case 'z':
+ /* We recognize four formats:
+ 1. Two digits specify hours.
+ 2. Four digits specify hours and minutes.
+ 3. Two digits, ':', and two digits specify hours and minutes.
+ 4. 'Z' is equivalent to +0000. */
+ {
+ val = 0;
+ while (ISSPACE (*rp))
+ ++rp;
+ if (*rp == 'Z')
+ {
+ ++rp;
+ //tm->tm_gmtoff = 0;
+ break;
+ }
+ if (*rp != '+' && *rp != '-')
+ return NULL;
+ bool neg = *rp++ == '-';
+ int n = 0;
+ while (n < 4 && *rp >= '0' && *rp <= '9')
+ {
+ val = val * 10 + *rp++ - '0';
+ ++n;
+ if (*rp == ':' && n == 2 && isdigit (*(rp + 1)))
+ ++rp;
+ }
+ if (n == 2)
+ val *= 100;
+ else if (n != 4)
+ /* Only two or four digits recognized. */
+ return NULL;
+ else if (val % 100 >= 60)
+ /* Minutes valid range is 0 through 59. */
+ return NULL;
+ //tm->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60;
+ //if (neg)
+ //tm->tm_gmtoff = -tm->tm_gmtoff;
+ }
+ break;
+ case 'E':
+#ifdef _NL_CURRENT
+ switch (*fmt++)
+ {
+ case 'c':
+ /* Match locale's alternate date and time format. */
+ if (s.decided != raw)
+ {
+ const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
+
+ if (*fmt == '\0')
+ fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+
+ if (!recursive (fmt))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (fmt, HERE_D_T_FMT))
+ s.decided = loc;
+ s.want_xday = 1;
+ break;
+ }
+ s.decided = raw;
+ }
+ /* The C locale has no era information, so use the
+ normal representation. */
+ if (!recursive (HERE_D_T_FMT))
+ return NULL;
+ s.want_xday = 1;
+ break;
+ case 'C':
+ if (s.decided != raw)
+ {
+ if (s.era_cnt >= 0)
+ {
+ era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
+ if (era != NULL && match_string (era->era_name, rp))
+ {
+ s.decided = loc;
+ break;
+ }
+ else
+ return NULL;
+ }
+
+ num_eras = _NL_CURRENT_WORD (LC_TIME,
+ _NL_TIME_ERA_NUM_ENTRIES);
+ for (s.era_cnt = 0; s.era_cnt < (int) num_eras;
+ ++s.era_cnt, rp = rp_backup)
+ {
+ era = _nl_select_era_entry (s.era_cnt
+ HELPER_LOCALE_ARG);
+ if (era != NULL && match_string (era->era_name, rp))
+ {
+ s.decided = loc;
+ break;
+ }
+ }
+ if (s.era_cnt != (int) num_eras)
+ break;
+
+ s.era_cnt = -1;
+ if (s.decided == loc)
+ return NULL;
+
+ s.decided = raw;
+ }
+ /* The C locale has no era information, so use the
+ normal representation. */
+ goto match_century;
+ case 'y':
+ if (s.decided != raw)
+ {
+ get_number(0, 9999, 4);
+ tm->tm_year = val;
+ s.want_era = 1;
+ s.want_xday = 1;
+ s.want_century = 1;
+
+ if (s.era_cnt >= 0)
+ {
+ assert (s.decided == loc);
+
+ era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
+ bool match = false;
+ if (era != NULL)
+ {
+ int delta = ((tm->tm_year - era->offset)
+ * era->absolute_direction);
+ /* The difference between two sets of years
+ does not include the final year itself,
+ therefore add 1 to the difference to
+ account for that final year. */
+ match = (delta >= 0
+ && delta < (((int64_t) era->stop_date[0]
+ - (int64_t) era->start_date[0])
+ * era->absolute_direction
+ + 1));
+ }
+ if (! match)
+ return NULL;
+
+ break;
+ }
+
+ num_eras = _NL_CURRENT_WORD (LC_TIME,
+ _NL_TIME_ERA_NUM_ENTRIES);
+ for (s.era_cnt = 0; s.era_cnt < (int) num_eras; ++s.era_cnt)
+ {
+ era = _nl_select_era_entry (s.era_cnt
+ HELPER_LOCALE_ARG);
+ if (era != NULL)
+ {
+ int delta = ((tm->tm_year - era->offset)
+ * era->absolute_direction);
+ /* See comment above about year difference + 1. */
+ if (delta >= 0
+ && delta < (((int64_t) era->stop_date[0]
+ - (int64_t) era->start_date[0])
+ * era->absolute_direction
+ + 1))
+ {
+ s.decided = loc;
+ break;
+ }
+ }
+ }
+ if (s.era_cnt != (int) num_eras)
+ break;
+
+ s.era_cnt = -1;
+ if (s.decided == loc)
+ return NULL;
+
+ s.decided = raw;
+ }
+
+ goto match_year_in_century;
+ case 'Y':
+ if (s.decided != raw)
+ {
+ num_eras = _NL_CURRENT_WORD (LC_TIME,
+ _NL_TIME_ERA_NUM_ENTRIES);
+ for (s.era_cnt = 0; s.era_cnt < (int) num_eras;
+ ++s.era_cnt, rp = rp_backup)
+ {
+ era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
+ if (era != NULL && recursive (era->era_format))
+ break;
+ }
+ if (s.era_cnt == (int) num_eras)
+ {
+ s.era_cnt = -1;
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ s.decided = loc;
+ break;
+ }
+
+ s.decided = raw;
+ }
+ get_number (0, 9999, 4);
+ tm->tm_year = val - 1900;
+ s.want_century = 0;
+ s.want_xday = 1;
+ break;
+ case 'x':
+ if (s.decided != raw)
+ {
+ const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
+
+ if (*fmt == '\0')
+ fmt = _NL_CURRENT (LC_TIME, D_FMT);
+
+ if (!recursive (fmt))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (fmt, HERE_D_FMT))
+ s.decided = loc;
+ break;
+ }
+ s.decided = raw;
+ }
+ if (!recursive (HERE_D_FMT))
+ return NULL;
+ break;
+ case 'X':
+ if (s.decided != raw)
+ {
+ const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
+
+ if (*fmt == '\0')
+ fmt = _NL_CURRENT (LC_TIME, T_FMT);
+
+ if (!recursive (fmt))
+ {
+ if (s.decided == loc)
+ return NULL;
+ else
+ rp = rp_backup;
+ }
+ else
+ {
+ if (strcmp (fmt, HERE_T_FMT))
+ s.decided = loc;
+ break;
+ }
+ s.decided = raw;
+ }
+ if (!recursive (HERE_T_FMT))
+ return NULL;
+ break;
+ default:
+ return NULL;
+ }
+ break;
+#else
+ /* We have no information about the era format. Just use
+ the normal format. */
+ if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
+ && *fmt != 'x' && *fmt != 'X')
+ /* This is an illegal format. */
+ return NULL;
+
+ goto start_over;
+#endif
+ case 'O':
+ switch (*fmt++)
+ {
+ case 'b':
+ case 'B':
+ case 'h':
+ /* Match month name. Reprocess as plain 'B'. */
+ fmt--;
+ goto start_over;
+ case 'd':
+ case 'e':
+ /* Match day of month using alternate numeric symbols. */
+ get_alt_number (1, 31, 2);
+ tm->tm_mday = val;
+ s.have_mday = 1;
+ s.want_xday = 1;
+ break;
+ case 'H':
+ /* Match hour in 24-hour clock using alternate numeric
+ symbols. */
+ get_alt_number (0, 23, 2);
+ tm->tm_hour = val;
+ s.have_I = 0;
+ break;
+ case 'I':
+ /* Match hour in 12-hour clock using alternate numeric
+ symbols. */
+ get_alt_number (1, 12, 2);
+ tm->tm_hour = val % 12;
+ s.have_I = 1;
+ break;
+ case 'm':
+ /* Match month using alternate numeric symbols. */
+ get_alt_number (1, 12, 2);
+ tm->tm_mon = val - 1;
+ s.have_mon = 1;
+ s.want_xday = 1;
+ break;
+ case 'M':
+ /* Match minutes using alternate numeric symbols. */
+ get_alt_number (0, 59, 2);
+ tm->tm_min = val;
+ break;
+ case 'S':
+ /* Match seconds using alternate numeric symbols. */
+ get_alt_number (0, 61, 2);
+ tm->tm_sec = val;
+ break;
+ case 'U':
+ get_alt_number (0, 53, 2);
+ s.week_no = val;
+ s.have_uweek = 1;
+ break;
+ case 'W':
+ get_alt_number (0, 53, 2);
+ s.week_no = val;
+ s.have_wweek = 1;
+ break;
+ case 'V':
+ get_alt_number (0, 53, 2);
+ /* XXX This cannot determine any field in TM without
+ further information. */
+ break;
+ case 'w':
+ /* Match number of weekday using alternate numeric symbols. */
+ get_alt_number (0, 6, 1);
+ tm->tm_wday = val;
+ s.have_wday = 1;
+ break;
+ case 'y':
+ /* Match year within century using alternate numeric symbols. */
+ get_alt_number (0, 99, 2);
+ tm->tm_year = val >= 69 ? val : val + 100;
+ s.want_xday = 1;
+ break;
+ default:
+ return NULL;
+ }
+ break;
+ default:
+ return NULL;
+ }
+ }
+
+ if (statep != NULL)
+ {
+ /* Recursive invocation, returning success, so
+ update parent's struct tm and state. */
+ *(struct __strptime_state *) statep = s;
+ *tmp = tmb;
+ return (char *) rp;
+ }
+
+ if (s.have_I && s.is_pm)
+ tm->tm_hour += 12;
+
+ if (s.century != -1)
+ {
+ if (s.want_century)
+ tm->tm_year = tm->tm_year % 100 + (s.century - 19) * 100;
+ else
+ /* Only the century, but not the year. Strange, but so be it. */
+ tm->tm_year = (s.century - 19) * 100;
+ }
+
+#ifdef _NL_CURRENT
+ if (s.era_cnt != -1)
+ {
+ era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
+ if (era == NULL)
+ return NULL;
+ if (s.want_era)
+ tm->tm_year = (era->start_date[0]
+ + ((tm->tm_year - era->offset)
+ * era->absolute_direction));
+ else
+ /* Era start year assumed. */
+ tm->tm_year = era->start_date[0];
+ }
+ else
+#endif
+ if (s.want_era)
+ {
+ /* No era found but we have seen an E modifier. Rectify some
+ values. */
+ if (s.want_century && s.century == -1 && tm->tm_year < 69)
+ tm->tm_year += 100;
+ }
+
+ if (s.want_xday && !s.have_wday)
+ {
+ if ( !(s.have_mon && s.have_mday) && s.have_yday)
+ {
+ /* We don't have tm_mon and/or tm_mday, compute them. */
+ int t_mon = 0;
+ while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday)
+ t_mon++;
+ if (!s.have_mon)
+ tm->tm_mon = t_mon - 1;
+ if (!s.have_mday)
+ tm->tm_mday =
+ (tm->tm_yday
+ - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
+ s.have_mon = 1;
+ s.have_mday = 1;
+ }
+ /* Don't crash in day_of_the_week if tm_mon is uninitialized. */
+ if (s.have_mon || (unsigned) tm->tm_mon <= 11)
+ day_of_the_week (tm);
+ }
+
+ if (s.want_xday && !s.have_yday && (s.have_mon || (unsigned) tm->tm_mon <= 11))
+ day_of_the_year (tm);
+
+ if ((s.have_uweek || s.have_wweek) && s.have_wday)
+ {
+ int save_wday = tm->tm_wday;
+ int save_mday = tm->tm_mday;
+ int save_mon = tm->tm_mon;
+ int w_offset = s.have_uweek ? 0 : 1;
+
+ tm->tm_mday = 1;
+ tm->tm_mon = 0;
+ day_of_the_week (tm);
+ if (s.have_mday)
+ tm->tm_mday = save_mday;
+ if (s.have_mon)
+ tm->tm_mon = save_mon;
+
+ if (!s.have_yday)
+ tm->tm_yday = ((7 - (tm->tm_wday - w_offset)) % 7
+ + (s.week_no - 1) * 7
+ + (save_wday - w_offset + 7) % 7);
+
+ if (!s.have_mday || !s.have_mon)
+ {
+ int t_mon = 0;
+ while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon]
+ <= tm->tm_yday)
+ t_mon++;
+ if (!s.have_mon)
+ tm->tm_mon = t_mon - 1;
+ if (!s.have_mday)
+ tm->tm_mday =
+ (tm->tm_yday
+ - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
+ }
+
+ tm->tm_wday = save_wday;
+ }
+
+ return (char *) rp;
+}
+
+
+char *
+strptime (const char *buf, const char *format, struct tm *tm LOCALE_PARAM)
+{
+ return __strptime_internal (buf, format, tm, NULL LOCALE_ARG);
+}
+
+#ifdef _LIBC
+weak_alias (__strptime_l, strptime_l)
+#endif
--- /dev/null
+--- ../../glibc/time/strptime_l.c 2023-06-25 08:08:49.327979261 -0600
++++ strptime_l.c 2023-06-30 06:45:48.529139134 -0600
+@@ -21,7 +21,7 @@
+
+ #include <assert.h>
+ #include <ctype.h>
+-#include <langinfo.h>
++//#include <langinfo.h>
+ #include <limits.h>
+ #include <string.h>
+ #include <time.h>
+@@ -59,13 +59,18 @@
+ #if defined __GNUC__ && __GNUC__ >= 2
+ # define match_string(cs1, s2) \
+ ({ size_t len = strlen (cs1); \
+- int result = __strncasecmp_l ((cs1), (s2), len, locale) == 0; \
++ int result = strncasecmp ((cs1), (s2), len) == 0; \
+ if (result) (s2) += len; \
+ result; })
+ #else
+ /* Oh come on. Get a reasonable compiler. */
+-# define match_string(cs1, s2) \
+- (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
++# ifdef _WIN32
++# define match_string(cs1, s2) \
++ (_strnicmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
++# else
++# define match_string(cs1, s2) \
++ (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
++# endif
+ #endif
+ /* We intentionally do not use isdigit() for testing because this will
+ lead to problems with the wide character version. */
+@@ -268,7 +273,7 @@
+ unsigned int want_century : 1;
+ unsigned int want_era : 1;
+ unsigned int want_xday : 1;
+- enum ptime_locale_status decided : 2;
++ enum ptime_locale_status decided : 3;
+ signed char week_no;
+ signed char century;
+ int era_cnt;
+@@ -788,7 +793,7 @@
+ if (*rp == 'Z')
+ {
+ ++rp;
+- tm->tm_gmtoff = 0;
++ //tm->tm_gmtoff = 0;
+ break;
+ }
+ if (*rp != '+' && *rp != '-')
+@@ -810,9 +815,9 @@
+ else if (val % 100 >= 60)
+ /* Minutes valid range is 0 through 59. */
+ return NULL;
+- tm->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60;
+- if (neg)
+- tm->tm_gmtoff = -tm->tm_gmtoff;
++ //tm->tm_gmtoff = (val / 100) * 3600 + (val % 100) * 60;
++ //if (neg)
++ //tm->tm_gmtoff = -tm->tm_gmtoff;
+ }
+ break;
+ case 'E':
+@@ -1162,6 +1167,7 @@
+ tm->tm_year = (s.century - 19) * 100;
+ }
+
++#ifdef _NL_CURRENT
+ if (s.era_cnt != -1)
+ {
+ era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
+@@ -1176,6 +1182,7 @@
+ tm->tm_year = era->start_date[0];
+ }
+ else
++#endif
+ if (s.want_era)
+ {
+ /* No era found but we have seen an E modifier. Rectify some